<?php

namespace app\hospital\model;

use app\model\Bookinfo;
use think\facade\Db;
use think\facade\Request;
use think\Model;

class patientreserve extends Model
{
    function search()
    {
        $key=Request::param('key');
        $data=patientreserve::withSearch(['patientname','doctorname','rtime'],[
            'patientname'=>$key,
            'doctorname'=>$key,
            'rtime'=>$key
        ])->paginate(['list_rows'=>3,'query'=>Request::param()]);
        return $data;
    }

    function searchpatientnameAttr($q,$v){
        $q->where('patientname','like','%'.$v.'%');

    }
    function searchdoctornameAttr($q,$v){
        $q->whereor('doctorname','like','%'.$v.'%');

    }
    function searchrtimeAttr($q,$v){
        $q->whereor('rtime','like','%'.$v.'%');

    }
}